package juc;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class LockDemo {
	private static Lock lock = new ReentrantLock();

	public static void main(String args[]){
		ArrayBlockingQueue queue = new ArrayBlockingQueue<>(10);
	    new Thread(() -> {
			// lock.lock();
			lock.lock();
			try {
				System.out.println("外层");
			} finally {
				lock.unlock();
				// lock.unlock();
			}
			System.out.println("end");
			lock.lock();
			try {
				System.out.println("外层");
			} finally {
				lock.unlock();
				lock.unlock();
			}

		}).start();
	}
}
